package com.hombio.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hombio.service.MedicineMSService;

import cn.edu.scau.cmi.hombio.domain.Medicine;


@Controller
public class MedicineController {

	@Autowired
	MedicineMSService medicineMSService;
	
	@RequestMapping("/m/list")
	public String listMedicine(){
		return "medicine-list";
	}
	
	@RequestMapping("/m/add")
	public String goAddMedicine(){
		return "medicine-add";
	}
	
	@RequestMapping("/m/storage")
	public String goMedicineStorage(){
		return "medicine-storage";
	}
	@RequestMapping("/m/putaway")
	public String goMedicinePutaway(){
		return "medicine-putaway";
	}
	@RequestMapping("/m/take")
	public String goMedicineTake(){
		return "medicine-take";
	}
	
	
	@RequestMapping("/m/batch/delete")
	@ResponseBody
	public void batchDeleteMedicine(String ids){
		medicineMSService.batchDeleteMedicine(ids);
	}
	@RequestMapping("/m/addMedicine")
	@ResponseBody
	public void addMedicine(@RequestBody Medicine medicine){
		medicineMSService.addMedicine(medicine);
	}
	@RequestMapping("/m/nothing")
	@ResponseBody
	public Medicine nothing(){
		Medicine m = new Medicine();
		m.setName("a");
		return m;
	}
}
